<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
	<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
<script type="text/javascript" src="../../js/common.js"></script>
<title>查询</title>
</head>
<body>
<div class="container-fluid">
	<div class="row">
		<div id="login_ajax">
			<div class="col-xs-12">
				<div class="user-picture">
					<a href="javascript:;">
						<img src="">
					</a>
					<p>未登录</p>
				</div>
			</div>
			<div class="col-xs-12">
				<div class="login-box">
					<div class="col-xs-3">
						用户状态
					</div>
					<div class="col-xs-9">

					</div>
				</div>
			</div>
		</div>
		<div class="col-xs-12">
			<div class="login-box">
				<div class="col-xs-3">
					到期时间
				</div>
				<div class="col-xs-9">
					2012-10-24
				</div>
			</div>
		</div>
		<div class="col-xs-12 login-class">
			<div class="col-xs-3"><a href="index.html">登陆</a></div>
			<div class="col-xs-3"><a href="recharge.html">充值</a></div>
			<div class="col-xs-3"><a href="query.html" class="active">查询</a></div>
			<div class="col-xs-3"><a href="register.html">注册</a></div>
		</div>
		<div class="col-xs-12" id="query_table">

		</div>

	</div>
	<footer>
		<div class="col-xs-3 col-xs-offset-2">
			<a href="index.html" class="btn_1_yes"></a>
		</div>
		<div class="col-xs-3">
			<a href="../game/index.html" class="btn_2"></a>
		</div>
		<div class="col-xs-3">
			<a href="../set/index.html" class="btn_3"></a>
		</div>
	</footer>
</div>
</body>
</html>
<script type="text/javascript" src="../../js/jquery-1.9.1.js"></script>
<script>
	loginState();
	// s判断登录状态
	function loginState(){
		var indexUrl = "http://aaa.57810.mom/index.php/Index/index";
		$.ajax({
			type : "get",
			url : indexUrl,
			dataType : "jsonp",
			jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
			jsonpCallback:"success_jsonpCallback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
			success : function(json){
				var loginForm = document.getElementById("query_table");
				if(json['isLogin']!=false){
					// 变更dom
					var login = document.getElementById('login_ajax');

					html = '<div class="col-xs-12"><div class="user-picture"><a href="javascript:;"><img src=""></a><p>'+json['nickname']+'</p></div></div><div class="col-xs-12"><div class="login-box"><div class="col-xs-3">用户状态</div>' ;
					if(json['userType']=="USER_TYPE_NORMAL") {
						html += '<div class="col-xs-9">普通</div></div></div>';
					}
					if(json['userType']=="USER_TYPE_vip") {
						html += '<div class="col-xs-9">vip</div></div></div>';
					}
					login.innerHTML = html;
					query = '<table cellspacing="0" cellpadding="0" class="query-table"><tr><td>充值时间</td><td>充值类型</td><td>生效日期</td><td>截止时间</td></tr><tbody></tbody></table>'
					loginForm.innerHTML = query;
					queryRecharge();
				}else{
					query = '<div class="col-xs-12"><div class="tips">未登录</div></div>';
					loginForm.innerHTML = query;
				}
			},
			error:function(){
				alert('fail');
			}
		});
	}

	//查询
	function queryRecharge(){

        var query = "http://aaa.57810.mom/index.php/Index/query";
		$.ajax({
			type : "get",
			url : query,
			dataType : "jsonp",
			jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
			jsonpCallback:"success_jsonpCallback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
			success : function(json){
				 alert(json);
			},
			error:function(){
				alert('fail');
			}
		});
	}
</script>
